Change in openvpn[master]: tls_crypt: append cipher final output at buffer end
A message that is not in the archive (sent off-list or not yet received): gerrit.1793618479000.Ie0f902ae5aa8e549f76f2cf32facda43eac18915@gerrit.openvpn.net
Attention is currently required from: Arne Schwabe.
Hello Arne Schwabe,
I'd like you to do a code review.
Please visit
https://gerrit.openvpn.net/c/openvpn/+/2083?usp=email
to review the following change.
Change subject: tls_crypt: append cipher final output at buffer end
......................................................................
tls_crypt: append cipher final output at buffer end
tls_crypt_wrap() and tls_crypt_unwrap() passed BPTR(dst) to cipher_ctx_final(), which would overwrite the start of dst if final produced output. Use BEND(dst), as the tls-crypt-v2 code does. No functional change with AES-256-CTR, whose final produces 0 bytes.
---
M src/openvpn/tls_crypt.c
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/83/2083/1
src/openvpn/tls_crypt.c +2 -2
@@ -191,7 +191,7 @@int outlen =0 ;ASSERT (cipher_ctx_update (ctx->cipher,BEND (dst), &outlen,CBPTR (src),BLEN (src)));ASSERT (buf_inc_len (dst, outlen)); -ASSERT (cipher_ctx_final (ctx->cipher,BPTR (dst), &outlen)); +ASSERT (cipher_ctx_final (ctx->cipher,BEND (dst), &outlen));ASSERT (buf_inc_len (dst, outlen)); }
@@ -247,7 +247,7 @@CRYPT_ERROR ("cipher update failed" ); }ASSERT (buf_inc_len (dst, outlen)); -if (!cipher_ctx_final (ctx->cipher,BPTR (dst), &outlen)) +if (!cipher_ctx_final (ctx->cipher,BEND (dst), &outlen)) {CRYPT_ERROR ("cipher final failed" ); }
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2083?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie0f902ae5aa8e549f76f2cf32facda43eac18915
Gerrit-Change-Number: 2083
Gerrit-PatchSet: 1
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Arne Schwabe <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Attention is currently required from: Răzvan Cojocaru.
Arne Schwabe has posted comments on this change by Răzvan Cojocaru. ( https://gerrit.openvpn.net/c/openvpn/+/2083?usp=email )
Change subject: tls_crypt: append cipher final output at buffer end
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2083?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie0f902ae5aa8e549f76f2cf32facda43eac18915
Gerrit-Change-Number: 2083
Gerrit-PatchSet: 1
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Răzvan Cojocaru <[email protected]>
Gerrit-Comment-Date: Mon, 02 Nov 2026 13:14:18 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Attention is currently required from: Răzvan Cojocaru.
Hello Arne Schwabe,
I'd like you to reexamine a change. Please visit
https://gerrit.openvpn.net/c/openvpn/+/2083?usp=email
to look at the new patch set (#2).
The change is no longer submittable: checks~ChecksSubmitRule is unsatisfied now.
Change subject: tls_crypt: append cipher final output at buffer end
......................................................................
tls_crypt: append cipher final output at buffer end
tls_crypt_wrap() and tls_crypt_unwrap() passed BPTR(dst) to cipher_ctx_final(), which would overwrite the start of dst if final produced output. Use BEND(dst), as the tls-crypt-v2 code does. No functional change with AES-256-CTR, whose final produces 0 bytes.
---
M src/openvpn/tls_crypt.c
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/83/2083/2
src/openvpn/tls_crypt.c +2 -2
@@ -191,7 +191,7 @@int outlen =0 ;ASSERT (cipher_ctx_update (ctx->cipher,BEND (dst), &outlen,CBPTR (src),BLEN (src)));ASSERT (buf_inc_len (dst, outlen)); -ASSERT (cipher_ctx_final (ctx->cipher,BPTR (dst), &outlen)); +ASSERT (cipher_ctx_final (ctx->cipher,BEND (dst), &outlen));ASSERT (buf_inc_len (dst, outlen)); }
@@ -247,7 +247,7 @@CRYPT_ERROR ("cipher update failed" ); }ASSERT (buf_inc_len (dst, outlen)); -if (!cipher_ctx_final (ctx->cipher,BPTR (dst), &outlen)) +if (!cipher_ctx_final (ctx->cipher,BEND (dst), &outlen)) {CRYPT_ERROR ("cipher final failed" ); }
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2083?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie0f902ae5aa8e549f76f2cf32facda43eac18915
Gerrit-Change-Number: 2083
Gerrit-PatchSet: 2
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: Răzvan Cojocaru <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
PATCH v2 1/1 tls_crypt: append cipher final output at buffer end
In reply to a message not in the archiveFrom: Razvan Cojocaru <[email protected]>
tls_crypt_wrap() and tls_crypt_unwrap() passed BPTR(dst) to cipher_ctx_final(), which would overwrite the start of dst if final produced output. Use BEND(dst), as the tls-crypt-v2 code does. No functional change with AES-256-CTR, whose final produces 0 bytes.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2083
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2083
This mail reflects revision 2 of this Change.
Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]>
src/openvpn/tls_crypt.c +2 -2
@@ -191,7 +191,7 @@int outlen =0 ;ASSERT (cipher_ctx_update (ctx->cipher,BEND (dst), &outlen,CBPTR (src),BLEN (src)));ASSERT (buf_inc_len (dst, outlen)); -ASSERT (cipher_ctx_final (ctx->cipher,BPTR (dst), &outlen)); +ASSERT (cipher_ctx_final (ctx->cipher,BEND (dst), &outlen));ASSERT (buf_inc_len (dst, outlen)); }
@@ -247,7 +247,7 @@CRYPT_ERROR ("cipher update failed" ); }ASSERT (buf_inc_len (dst, outlen)); -if (!cipher_ctx_final (ctx->cipher,BPTR (dst), &outlen)) +if (!cipher_ctx_final (ctx->cipher,BEND (dst), &outlen)) {CRYPT_ERROR ("cipher final failed" ); }
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
[Openvpn-devel] [PATCH applied] Re: tls_crypt: append cipher final output at buffer end
I know nothing about this crypto API thingies... but Arne +2'ed it, and also requested backport to older versions ("in case one of the SSL libraries change their inner workings, it might trigger one day").
Your patch has been applied to the master, release/2.7 and release/2.6 branch. The code is almost identical, so it cherrypicked just fine.
Ran the 2.7 code on a t_server setup with tls-crypt + v2 in use, and the 2.6 code on a t_client setup with tls-crypt (v1).
commit e48597a63e7ba1d003f834cf3605b965d64a6e29 (master) commit 7f5ace11bcab4815f85b01e749b9ab46ffbbf3b7 (release/2.7) commit c719e20ec424b5bad41ec1f5d3d0d5a0912bbb96 (release/2.6)
Author: Razvan Cojocaru Date: Mon Nov 2 18:13:17 2026 +0100
tls_crypt: append cipher final output at buffer end
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2083
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg40536.html
--
kind regards,
Gert Doering
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Gert Doering has uploaded a new patch set (#3) to the change originally created by Răzvan Cojocaru. ( https://gerrit.openvpn.net/c/openvpn/+/2083?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by Arne Schwabe
Change subject: tls_crypt: append cipher final output at buffer end
......................................................................
tls_crypt: append cipher final output at buffer end
tls_crypt_wrap() and tls_crypt_unwrap() passed BPTR(dst) to cipher_ctx_final(), which would overwrite the start of dst if final produced output. Use BEND(dst), as the tls-crypt-v2 code does. No functional change with AES-256-CTR, whose final produces 0 bytes.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2083
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg40536.html
---
M src/openvpn/tls_crypt.c
1 file changed, 2 insertions(+), 2 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/83/2083/3
src/openvpn/tls_crypt.c +2 -2
@@ -188,7 +188,7 @@int outlen =0 ;ASSERT (cipher_ctx_update (ctx->cipher,BEND (dst), &outlen,CBPTR (src),BLEN (src)));ASSERT (buf_inc_len (dst, outlen)); -ASSERT (cipher_ctx_final (ctx->cipher,BPTR (dst), &outlen)); +ASSERT (cipher_ctx_final (ctx->cipher,BEND (dst), &outlen));ASSERT (buf_inc_len (dst, outlen)); }
@@ -244,7 +244,7 @@CRYPT_ERROR ("cipher update failed" ); }ASSERT (buf_inc_len (dst, outlen)); -if (!cipher_ctx_final (ctx->cipher,BPTR (dst), &outlen)) +if (!cipher_ctx_final (ctx->cipher,BEND (dst), &outlen)) {CRYPT_ERROR ("cipher final failed" ); }
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2083?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie0f902ae5aa8e549f76f2cf32facda43eac18915
Gerrit-Change-Number: 2083
Gerrit-PatchSet: 3
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel
Gert Doering has submitted this change. ( https://gerrit.openvpn.net/c/openvpn/+/2083?usp=email )
Change subject: tls_crypt: append cipher final output at buffer end
......................................................................
tls_crypt: append cipher final output at buffer end
tls_crypt_wrap() and tls_crypt_unwrap() passed BPTR(dst) to cipher_ctx_final(), which would overwrite the start of dst if final produced output. Use BEND(dst), as the tls-crypt-v2 code does. No functional change with AES-256-CTR, whose final produces 0 bytes.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2083
Message-Id: <[email protected]>
URL: https://www.mail-archive.com/[email protected]/msg40536.html
---
M src/openvpn/tls_crypt.c
1 file changed, 2 insertions(+), 2 deletions(-)
src/openvpn/tls_crypt.c +2 -2
@@ -188,7 +188,7 @@int outlen =0 ;ASSERT (cipher_ctx_update (ctx->cipher,BEND (dst), &outlen,CBPTR (src),BLEN (src)));ASSERT (buf_inc_len (dst, outlen)); -ASSERT (cipher_ctx_final (ctx->cipher,BPTR (dst), &outlen)); +ASSERT (cipher_ctx_final (ctx->cipher,BEND (dst), &outlen));ASSERT (buf_inc_len (dst, outlen)); }
@@ -244,7 +244,7 @@CRYPT_ERROR ("cipher update failed" ); }ASSERT (buf_inc_len (dst, outlen)); -if (!cipher_ctx_final (ctx->cipher,BPTR (dst), &outlen)) +if (!cipher_ctx_final (ctx->cipher,BEND (dst), &outlen)) {CRYPT_ERROR ("cipher final failed" ); }
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2083?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie0f902ae5aa8e549f76f2cf32facda43eac18915
Gerrit-Change-Number: 2083
Gerrit-PatchSet: 3
Gerrit-Owner: Răzvan Cojocaru <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel